﻿@model Domain.NetworkService.Description
@using (Html.BeginForm("AddTestTcp", "Manage", FormMethod.Post, new { id = "TcpForm", @class = "invisible" }))
{
    @Html.Hidden("devName", null, new { value = ViewBag.devName });
    @Html.HiddenFor(m => m.networkTestDescription, new { @Value = Domain.NetworkService.NetworkTestDescription.TCP });
    @Html.Label("IP: ");
    @Html.TextBoxFor(m => m.HostNameOrIP, new
{
    type = "text",
    required = "required",
    pattern = @"((^|\.)((25[0-5])|(2[0-4]\d)|(1\d\d)|([1-9]?\d))){4}$",
    oninvalid = "this.setCustomValidity('Необходим IP адрес')",
    oninput = "setCustomValidity('')"
});
    @Html.Label(" Timeout: ");
    @Html.TextBoxFor(m => m.Timeout, new
{
    type = "number",
    @Value = "10",
    min = "1",
    max = "3600",
    maxlength = "4",
    oninvalid = "this.setCustomValidity('От 1 до 3600 секунд')",
    oninput = "setCustomValidity('')"
});
    @Html.Label(" Port: ");
                          List<string> portList = new List<string>();
                          foreach (Domain.NetworkService.TcpPorts tcpPorts in Enum.GetValues(typeof(Domain.NetworkService.TcpPorts)))
                          {
                              portList.Add(tcpPorts.ToString());
                          }
                          IEnumerable<SelectListItem> portSelLstItems = portList.Select(i => new SelectListItem()
                          {
                              Text = i.ToString(),
                              Value = i
                          });
    @Html.DropDownList("SpecialTcp", portSelLstItems, new { id = "SpecialTcp" });
    <input class="btn" type="submit" value="Добавить" />
}